<include file="Weixin/header" />
<title>用户注册</title>
</head>
<body class="clearfix">
	<div class="login-box">
		<div class="logo clearfix">
			<img src="__PUBLIC__/weixin/images/logo.png">
		</div>
		<div class="form clearfix">
			<div class="item">
				<input type="text" placeholder="请输手机号" id="phone" name="phone" />
			</div>
			<div class="item">
				<input type="text" placeholder="请输入验证码" id="code" name="code" />
				<div class="mar">获取验证码</div>
			</div>
			<div class="item">
				<input type="password" placeholder="请输入密码" id="password" name="password" />
				<div class="icon"><img src="__PUBLIC__/weixin/images/cld.png" /></div>
			</div>
			<div class="tex">密码格式为6-16位数字，字母或符号</div>
		</div>
		<div class="btn">
			<img src="__PUBLIC__/weixin/images/btn.png">
			<div class="tex">完成并登陆</div>
		</div>
	</div>
	<script>
		$(document).ready(function(){
			$("div.tex").on('click', function(){
				var data = {};
				var phone = $("#phone").val() || "";
				var password = $("#password").val() || "";
				var code = $("#code").val() || "";
				
				if(phone.length <= 0 || phone.length > 11){
					layer.msg("请正确输入手机号", {icon:5, time: 2000});
					return false;
				}else{
					data.username = phone;
				}
				
				if(password.length <= 0 || password.length > 16){
					layer.msg("请正确输入密码", {icon:5, time: 2000});
					return false;
				}else{
					data.password = password;
				}
				
				$.post('register.html', data, function(row){
					if(row/1 == 1){
						layer.msg("注册成功", {icon:1,time:2000}, function(){
							//跳转页面
							window.location.href = 'village.html';
						});
					}else if(row/1 == 2){
						layer.msg("帐号已注册", {icon:5, time: 2000});
					}else{
						layer.msg("注册失败", {icon:5, time: 2000});
					}
				});
			});
		});
	</script>
</body>
</html>